<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="utf-8"/>
    <title>forget</title>
    <base th:href="${#request.getContextPath()}+'/'">
    <link rel="stylesheet" type="text/css" href="css/public.css"/>
    <link rel="stylesheet" type="text/css" href="css/proList.css"/>
    <link rel="stylesheet" type="text/css" href="css/forget.css"/>
    <link rel="stylesheet" type="text/css" href="css/public.css"/>
    <link rel="stylesheet" type="text/css" href="css/mygrxx.css"/>
</head>
<body><!----------------------------------------order------------------>
<div class="order cart"><!-----------------logo------------------->
    <div class="logo"><h1 class="wrapper clearfix">
        <a href="User/loginGet"><img class="fl" src="img/temp/logo.png"></a>
    </h1></div>
    <div class="forCon"><p>安全设置-找回密码</p>
        <ul>
            <li class="on">找回密码</li>
        </ul>
    </div>
    <div class="forCon">
        <div class="formCon"><!--步骤1-->
        <form class="remima">
            <input type="hidden" value="123456" id="pwd" name="userpassword" readonly="readonly"><label></label><br/>
            <p> <span>昵称: </span>
                <input type="text" value="" placeholder="请输入账号" id="usernum" name="usernumber">
            </p>
            <p style="position: relative">
                <span>验证码：</span>
                <input type="text" id="code"/>
                <img src="" id="codeImg1" alt="" height="30" style="position: absolute;margin-top: 20px"/></p>
            <p class="op">按右图输入验证码，注意区分大小写</p>
            <p>
                <button onclick="changs()" style="background:red;font-size: 20px;margin-left: 230px" >提交</button>

            </p>
        </form>
        <!--                <input type="button" value="确定" onclick="changs()"class="next"></form>&lt;!&ndash;步骤2&ndash;&gt;-->
        <!--            <form action="#" method="post" class="two"><p>电子邮箱：<span>114081*****qq.com</span></p>-->
        <!--                <p class="tip">验证邮件已发往你的电子邮箱，请点击邮件中的链接完成验证</p><input type="button" value="去邮箱验证" class="next1"></form>-->
        <!--步骤3-->
        <!--            <form action="#" method="post" class="three"><label>新密码：</label><input type="text" value=""><br/><label>确认密码：</label><input-->
        <!--                    type="text" value=""><br/><input type="button" value="完成"></form>-->
    </div>
    </div>

</div>
<script src="js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/public.js" type="text/javascript" charset="utf-8"></script>
<script src="js/pro.js" type="text/javascript" charset="utf-8"></script>
<script src="js/user.js" type="text/javascript" charset="utf-8"></script>
<script>
    $(function () {
        changeCode();
        $("#codeImg1").bind("click", changeCode);
    });

    //加载时间戳，防止浏览器利用缓存
    function genTimestamp() {
        var time = new Date();
        return time.getTime();
    }

    function changeCode() {
        $("#codeImg1").attr("src", "/validCode/code?t=" + genTimestamp());
    }
    function changs(){
        // alert(123)
        // let pwd = $("#pwd").val();
        let usernum = $("#usernum").val();
        let code = $("#code").val();
        $.post("/User/userforgetpassword",
            {
                'userNumber':usernum,
                'code':code
            },function (response) {
                console.log(response)
                alert(response.msg)
                window.location.href="/User/loginUser"
            })
    }
</script>
</body>
</html>